import os.path
from attributes import *
from script import *
from shader import *
from stage import *
from phuce import packages
from phuce import textures

shaders = {}

def load(filename):
  if filename in shaders:
    print 'S',
  else:
    basename, extension = os.path.splitext(filename)
    texture = textures.load(extension and filename or basename + '.tga')
    if texture:
      print 'T',
    else:
      print 'E',
  print filename
  return None

def load_scripts(path):
  for filename in packages.filenames(path):
    if filename.endswith('.shader'):
      shaders.update(ShaderScript.parse(packages.open(filename).read(), filename, verbose=False))

def unload():
  shaders = []
